<%-- 
    Document   : ficheproduit
    Created on : 5 mars 2013, 16:25:56
    Author     : Alice
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html>

<jsp:include page="header.jsp"></jsp:include>

<s:div id="bloc_contenu">
    <h2>Fiche produit</h2>
    <s:div id="bloc_produit_description">

        <table border="0" width="845px">

            <s:form namespace="/" action="ajouterPanier" theme="simple">
                <s:hidden name="idProduct" />        
                <tr>
                    <td valign="top" class="td_miniature"><img src="pages/img/img_produit_type/${product.idProductType}.jpg" width="90%" height="90%"/>
                    </td>
                    <td valign="top"><b>${product.title}</b><br /><br />${product.description}
                        <s:div id="bloc_note">
                            <c:if test="${not empty nbEtoile}">
                                <img src="pages/img/etoile${nbEtoile}.png"/> <i><font size="2" color="grey">(${product.score.getVoteValue()} vote(s) positive(s))
                                    <br />${product.score.getVoteCount()} vote(s)</font></i>
                                </c:if>
                                <c:if test="${empty nbEtoile}">
                                <img src="pages/img/etoile0.png"/>
                            </c:if>
                            <br />
                            <c:if test="${not empty sessionScope['USER']}">   
                                <c:set var="idP" value="${product.idProductType}"/>
                                <s:a action="noter">
                                    <s:param name="idProd"><c:out value="${idP}"></c:out></s:param>
                                    <s:param name="val" value="'up'"></s:param>
                                    <img src="pages/img/thumbup.png" width="20" height="20">
                                </s:a>
                                <s:a action="noter">
                                    <s:param name="idProd"><c:out value="${idP}"></c:out></s:param>
                                    <s:param name="val" value="'down'"></s:param>
                                    <img src="pages/img/thumbdw.png" width="20" height="20"/>
                                </s:a>
                            </c:if>                        

                            <br /> 
                            <br /> 
                            <c:if test="${empty sessionScope['USER']}">                                              
                                <a href="connection.jsp?title=${product.title}&description=${product.description}&idProductType=${product.idProductType}&redirectComment='1'">Donner votre avis</a> 
                            </c:if>

                            <c:if test="${not empty sessionScope['USER']}">                                                  
                                <a href="comment.jsp?title=${product.title}&description=${product.description}&idProductType=${product.idProductType}">Donner votre avis</a> 
                            </c:if>


                        </s:div>

                        <s:div id="bloc_titre_avis">  
                        </s:div>
                        <s:div id="bloc_avis">

                            ${message}
                            <c:forEach var="com" items="${commentaires}">
                                <s:div cssClass="comment_pseudo">${com.idUser.firstName} | ${com.dateCreation}</s:div>
                                <s:div cssClass="comment">${com.description}</s:div>
                            </c:forEach>
                        </s:div>
                    </td>
                    <td valign="top" class="td_miniature"><font color="#b22233" size="4"><b>
                            <s:if test="#session['USER'] != null">
                                    <s:if test="#session['USER'].getCountry().devise=='USD'">
                                        <c:out value="${product.price*sessionScope['RATE']}" /> $
                                    </s:if>
                                    <s:else>
                                        ${product.price} €
                                    </s:else>
                                </s:if>
                                <s:else>
                                    ${product.price} €
                                </s:else>
                        </b></font><br />
                        <s:submit type="image" src="pages/img/btn_ajouter.jpg" />
                        <br /> En stock
                        <img src="pages/img/ico_en_stock.png"/>
                        <s:select name="quantity" label="Quantité" list="liste" />
                    </td>
                </tr>   
            </s:form>
        </table>
    </s:div>




</s:div>
<jsp:include page="footer.jsp"></jsp:include>
